package com.w.tank;

public class BullectWallColl implements Collider{
    @Override
    public boolean collide(GameObject g1, GameObject g2) {
        if(g1 instanceof Bullet && g2 instanceof Wall || g1 instanceof Wall && g2 instanceof Bullet){
            Bullet bu;
            Wall w;
            try {
                bu = (Bullet)g1;
                w = (Wall)g2;
            }catch (Exception e){
                bu = (Bullet)g2;
                w = (Wall)g1;
            }

            if(bu.rect.intersects(w.rect)){
                bu.destory();
                return true;
            }


        }
        return true;


    }
}
